define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.borrow/index',
        add_url: 'mall.borrow/add',
        edit_url: 'mall.borrow/edit',
        delete_url: 'mall.borrow/delete',
        export_url: 'mall.borrow/export',
        modify_url: 'mall.borrow/modify',
        approval_url: 'mall.borrow/approval',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                limit:15,
                toolbar: [],
                // search:true,
                defaultToolbar:[],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',width: 80},
                    {field: 'type', title: '线上/线下',selectList: {1:'线上',2:'线下'},width: 120},
                    {field: 'reference', title: '档号',width: 120},
                    {field: 'filename', title: '文件名'},
                    // {field: 'create_time', title: '',width: 150},
                    {field: 'borrowers', title: '借阅人',width: 120},
                    {field: 'handled', title: '经办人',width: 120},
                    {field: 'times', title: '借阅时间',width: 150},
                    {field: 'remark', title: '备注说明', templet: ea.table.text},
                    {field: 'status', title: '文件/案卷',selectList: {1:'文件',2:'案卷'},width: 120},
                    {field: 'back_times', title: '归还时间',width: 150},
                    {
                        width: 120,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '审核',
                                url: init.approval_url,
                                method: 'text',
                                title: '确定通过审核吗？',
                                auth: 'approval',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                            }],
                            'delete']
                    }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});